
class Student {
    /**
     * <类和对象>课堂代码练习
     */
    private String name;
    private int age;//外部看不到

   public static String classroom;


    public Student(String name, int age) {//构造方法
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    public void func1() {
        System.out.println(this.name+"正在学习");
    }
    public void eat() {
        System.out.println(this.name+"正在吃饭");
    }

    public String getClassroom() {
        return classroom;
    }

    public void setClassroom(String classroom) {
        this.classroom = classroom;
    }
    public static void run() {
        System.out.println("正在跑步");
    }
}



public class Test {

    public static void main(String[] args) {
        Student student1 = new Student("张三",19);
        student1.setClassroom("5-101");

        Student student2 = new Student("李四",18);
        Student.classroom = "5-101";

        student2.run();


    }
    public static void main1(String[] args) {
        Student student1 = new Student("张三",18);
        student1.setName("李四");
        System.out.println(student1.getName());
        student1.func1();
    }
}
